import Category from '../models/Category.js'

let fn_CategoryAll = async ctx => {
  try{
    let data = await Category.findAll()
    ctx.status = 201
    ctx.body = { message: '获取数据成功', data }
  }
  catch(err){
    ctx.status = 400
    ctx.body = { message: '获取数据失败', data }
  }
}

export default [
  {
    method : 'get',
    url : 'api/category',
    fn : fn_CategoryAll
  }
]